package com.kunbo.util;

public class RedisKeyUtil {

    private static final String SPLIT = ":";

    private static final String PREFIX_ENTITY_LIKE = "like:entity";//实体的赞
    private static final String PREFIX_ENTITY_LOGIN = "like:entity";//实体的赞
    private static final String PREFIX_FOLLOWEE = "followee";//实体的赞
    private static final String PREFIX_FOLLOWER = "follower";//实体的赞

    //某个实体的赞
    //谁给实体点了赞就存入userId
    //like:entity:entityType:entityId -> set(userId)
    public static String getEntityLikeKey(int entityId){
        return PREFIX_ENTITY_LOGIN + SPLIT +entityId;
    }

    //获得like:entity:1_2:1
    public static String getEntityLikeKey(String conversationId, int entityId){
        return PREFIX_ENTITY_LIKE + SPLIT + conversationId + SPLIT +entityId;
    }

    //某个用户关注的实体
    //followee:1 ->zset(entityId, now)
    public static String getFolloweeKey(int userId, int entityType){
        return PREFIX_FOLLOWEE + SPLIT + userId;
    }

    //某个用户拥有的粉丝
    //follow：1 -> zset(userId, now)
    public static String getFollowerKey(int entityType, int entityId){
        return PREFIX_FOLLOWER + SPLIT + entityId;
    }
}
